/** @format */

import { IUser } from "@/types/user";
import { Button, Col, Form, Input, Row, Space } from "antd";

interface Props {
  onSubmit: (values: IUser) => void;
}

const UserFilterForm: React.FC<Props> = ({ onSubmit }) => {
  const [form] = Form.useForm();

  const onFinish = (values: IUser) => {
    onSubmit(values);
  };

  return (
    <Form form={form} name="" onFinish={onFinish}>
      <Row gutter={24} wrap={true}>
        <Col span={20}>
          <Form.Item name="username" label="用户名">
            <Input placeholder="用户名" />
          </Form.Item>
        </Col>
        <Col span={20}>
          <Form.Item name="username" label="用户名">
            <Input placeholder="用户名" />
          </Form.Item>
        </Col>
      </Row>
      <div className="flex justify-end">
        <Space size="small">
          <Button type="primary" htmlType="submit">
            查询
          </Button>
          <Button
            onClick={() => {
              form.resetFields();
            }}
          >
            重置
          </Button>
        </Space>
      </div>
    </Form>
  );
};

export default UserFilterForm;
